﻿var MyProfileValidate = {};
MyProfileValidate.option = g_langID == 2052 ? "请选择" : "select";
MyProfileValidate.emailNull = g_langID == 2052 ? "请输入您的Email地址" : "Please enter your email address.";
MyProfileValidate.emailerror = g_langID == 2052 ? "请输入有效的电子邮件地址" : "Please enter a valid email address.";
MyProfileValidate.emailexist = g_langID == 2052 ? "该电子邮件地址已经存在" : "The Email already exists.";
MyProfileValidate.userexist = g_langID == 2052 ? "该用户已经存在" : "Username already exists.";
MyProfileValidate.usernameNull = g_langID == 2052 ? "请输入您的用户名" : "Please enter your username";
MyProfileValidate.oldpwNull = g_langID == 2052 ? "原密码不能为空" : "he original password can not be empty";
MyProfileValidate.newpwNull = g_langID == 2052 ? "新密码不能为空" : "New password can not be empty";
MyProfileValidate.passNull = g_langID ==2052 ? "请输入密码" : "Please enter a password.";
MyProfileValidate.newpwconNull = g_langID == 2052 ? "两次输入密码不匹配.请重试" : "The password you entered does not match. Please try again.";
MyProfileValidate.pwcoflct = g_langID == 2052 ? "两次输入密码不匹配. 请重试" : "The password you entered does not match. Please try again.";
MyProfileValidate.pwlength = g_langID == 2052 ? "密码长度为6到18位" : "Please use 6-18 characters.";
MyProfileValidate.pwformat = g_langID == 2052 ? "密码由字母、数字或下划线组成,请重试" : "Password can contain only letters [a–z], numbers [0–9] or underscores [_]. Please try again.";
MyProfileValidate.username = g_langID == 2052 ? "用户名由字母、数字或下划线组成,请重试" : "Username can contain only letters [a–z], numbers [0–9] or underscores [_]. Please try again.";
MyProfileValidate.userlength = g_langID == 2052 ? "用户名长度为4到10位" : "Plaase use 4 to 10 characters.";
MyProfileValidate.phonenum = g_langID == 2052 ? "无效的手机号码,请重试" : "Invalid mobile phone number. Please try again.";
MyProfileValidate.Agreement = g_langID == 2052 ? "请同意网站协议" : "Please make sure you have read and agreed to the registration terms of website activities.";
MyProfileValidate.Verification = g_langID == 2052 ? "你输入的验证码不匹配,请重试" : "The characters you entered didn't match the verification. Please try again.";
MyProfileValidate.VerificationTimeout = g_langID == 2052 ? "网络超时，请重新输入验证码" : "Net Error,Please enter code again";
MyProfileValidate.telephonenum = g_langID == 2052 ? "无效的区号,请重试" : "Invalid telephone number. Please try again.";



MyProfileValidate.registerSuccess = g_langID == 2052 ? "您的UK NOW账户已经创建。 感谢您的注册" : "Your UK Now account was created. Thank you for registering";
MyProfileValidate.registerError = g_langID == 2052 ? "注册失败,请重试" : "Registration Failed. Please try again.";

MyProfileValidate.registerSuccess = g_langID == 2052 ? "您的UK NOW账户已经创建。 感谢您的注册" : "Your UK Now account was created. Thank you for registering";
MyProfileValidate.registerError = g_langID == 2052 ? "注册失败,请重试" : "Registration failed. Please try again.";
MyProfileValidate.inputemail = g_langID == 2052 ? "请输入你的常用邮箱" : "Please enter your email address.";
MyProfileValidate.inputusername = g_langID == 2052 ? "请输入你的用户名" : "Please enter your username.";
MyProfileValidate.inputphone = g_langID == 2052 ? "请正确填写手机号码" : "Enter your mobile phone number if you want.";
MyProfileValidate.inputtelephone = g_langID == 2052 ? "请正确填写区号" : "Enter your telephone number if you want.";





function GetProvice(provice, city) {
    $.ajax({
        type: "GET",
        url: "/GateService/CommonAjax.aspx",
        dataType: "json",
        async: false,
        data: "cmd=SelectProvices&random=" + new Date().toLocaleString(),
        beforeSend: function (XMLHttpRequest) {
        },
        success: function (data, textStatus) {
            $('#Provicelist').html("");
            var html = $('#Provicelist');
            html.append(PresentHtml(data, provice
            ));
            if (provice != null || provice != "undefined") {
                GetCity(city);
            }
        },
        complete: function (XMLHttpRequest, textStatus) {

        },
        error: function () {
            //错误处理
            alert('errorcity');
        }
    });
}

function PresentHtml(data, value) {
    var s = "<option value='-1' >" + MyProfileValidate.option + "</option>";
    if (data != null && data != "undefined") {
        $.each(data, function (index, row) {
            var cnname = IsNull(row.Cnname);
            var enname = IsNull(row.Enname);
            //alert(enname);
            var cid = IsNull(row.Cid);
            // alert(cid);
            var showcity = g_langID == 2052 ? cnname : enname;
            if (value != null && value != "undefined" && cid == value) {
                s += "<option value=" + cid + " selected >" + showcity + "</option>";
            } else {
                s += "<option value=" + cid + " >" + showcity + "</option>";
            }
        });
    }
    return s;
}


function GetCity(value) {
    var pid = $("#Provicelist").val();
    $.ajax({
        type: "GET",
        url: "/GateService/CommonAjax.aspx",
        dataType: "json",
        async: false,
        data: "cmd=SelectCity&proviceid=" + pid + "&random=" + new Date().toLocaleString(),
        beforeSend: function (XMLHttpRequest) {
        },
        success: function (data, textStatus) {
            $('#Citylist').html("");
            var html = $('#Citylist');
            html.append(PresentHtml(data, value));

        },
        complete: function (XMLHttpRequest, textStatus) {

        },
        error: function () {
            alert('errorcity');
        }
    });

}